<?php if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Lookup_v2 extends CI_Controller
{

    function lookup_v2()
    {
        parent::__construct();
        $this->load->library('session');
        $this->load->library('form_validation');
        $this->load->library('encrypt');
		$this->load->model('mmaster');
        $this->load->model('mlookupv2');
		$this->load->model('mlookupv1');
		
        $this->is_logged_in();
        #$this->mjadwal->saveLog();
    }
	
	function is_logged_in()
    {
        $is_logged_in = $this->session->userdata('is_logged_in');
        if (!isset($is_logged_in) || $is_logged_in != true) {
            redirect(base_url() . 'index.php/login');
        }
    }
	
	 function gpsInterval()
    {
        $data['template'] = "shell/smooth-side";
        //$data['users'] = $this->mlookupv1->getKey('identity_type', $id);
        $data['main_view'] = 'gps_interval';
//        $data['id'] = $id;

        $data['data']['lookup_value'] = "";
        
		//ambil data dari database
		$getdata = $this->mlookupv1->getKey('mobile_lonlat_interval');
		foreach($getdata as $key=>$value){
	
			$data['data']['lookup_value']=$value->lookup_value;
		}
       // $data['data']['lookup_value'] = ->0->lookup_value;
        
		#inisialisasi elemen form yang harus diisi
        $this->form_validation->set_rules('lookup_value', 'required');
		//$this->form_validation->set_error_delimiters('<li>', '</li>');
        $this->form_validation->set_message('required', 'Kolom <b>%s</b> harus diisi.');

        $value = $this->input->post("lookup_value");

        if ($this->form_validation->run() != false) {
            // update data di sini
            $this->mlookupv2->update_gps_int('144');
            
                $this->session->set_flashdata('message', 'Data berhasil diubah');   
            
			redirect(base_url() . "index.php/lookup_v2/gpsInterval");
        }

        $this->load->view($data['template'], $data);
    }
	
}
?>